<?php
/**
 * wvFormValidateValidator class file.
 *
 * @author Rangel Reale <rangelreale@gmail.com>
 * @link http://www.yiiframework.com/
 * @copyright Copyright &copy; 2010 Rangel Reale
 * @license http://www.yiiframework.com/license/
 */

/**
 * Adds a custom jQuery.validation rule.
 *
 * @author Rangel Reale <rangelreale@gmail.com>
 * @package wvActiveForm
 */
class wvFormValidateValidator extends wvFormValidator
{
	/**
	 * @var string jQuery.validation rule name
	 */
	public $rule;

	/**
	 * @var mixed validation value
	 */
	public $value = true;

	/**
	 * @var string message
	 */
	public $message;

	/**
	 * Creates the rule.
	 */
	public function createRule($rules, $id, $name, $attributeName)
	{
		$message=$this->message!==null?$this->message:null;
		$rules->addValidateRule($id, $name, $this->rule, $this->value, $message);
	}
}
?>
